#include <stddef.h>
#include <stdint.h>

#include "crypto/hmac.h"
#include "hmac.hpp"

namespace crypto
{
	int Hmac::sha1(const void * key, size_t keylen, 
						const void * in, size_t inlen, std::string & resstr)
	{
		uint32_t resbuf[5];

		int ret = hmac_sha1(key, keylen, in, inlen, (void*)resbuf);

		resstr.assign((char*)resbuf, sizeof(resbuf));

		return ret;
	}

	int Hmac::md5 (const void *key, size_t keylen,
						const void *in, size_t inlen, std::string & resstr)
	{
		uint32_t resbuf[4];

		int ret = hmac_md5(key, keylen, in, inlen, (void*)resbuf);

		resstr.assign((char*)resbuf, sizeof(resbuf));

		return ret;
	}
};

